<!DOCTYPE html>
<html>
<head>

<meta name="viewport"
	content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="format-detection" content="email=no" />
<meta name="wap-font-scale" content="no" />
<meta name="viewport" content="user-scalable=no, width=device-width" />
<meta content="telephone=no" name="format-detection" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>知文招标网 - 登录</title>
<meta name="description"
	content="，AXUI前端框架是面向设计，满足设计多样化需求的前端解决方案，减少或剔除JS文件资源和API。AXUI前端框架原则是能用css写的不用js；能用js写的不用插件；能用插件的不重复引用插件。核心文件只有ax.css和ax.js，加载速度飞快。">
<meta name="keywords" content=",前端框架,UI,CSS3,HTML5,原生JS,面向设计,前端工程师">

<link href="css/ax.css" rel="stylesheet" type="text/css">
<link href="css/ax-response.css" rel="stylesheet" type="text/css">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link rel="short icon" href="images/28.jpg">
</head>

<body class="ax-align-origin">


	<div class="login ax-shadow-cloud ax-radius-md">
		<div class="ax-row ax-radius-md ax-split">
			<div class="ax-col ax-col-14 ax-radius-left ax-radius-md cover"></div>
			<div class="ax-col ax-col-10">
				<div class="core">

					<div class="ax-break"></div>

					<div class="ax-tab" axTab>

						<ul class="ax-row ax-tab-nav ax-menu-tab">
							<a href="javascript:void(0)" class="ax-item">登录账号</a>
							<a href="javascript:void(0)" class="ax-item">注册新用户</a>
							<li class="ax-col"></li>
						</ul>

						<ul class="ax-tab-content">
							<li>
								<form>

									<div class="ax-break"></div>
									<div class="ax-break ax-hide-tel"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-me-f"></i></span> <input
														name="username" value="chw" placeholder="输入用户名/邮箱"
														type="text" id="mname">
													<div class="user_error" style="color: red; display: none">账号不能为空...</div>
													<span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"> </a></span>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-lock-f"></i></span> 
														<input name="password" placeholder="输入密码" type="password" id="pwd">
													<div class="pwd_error" style="color: red; display: none">密码格式错误...</div>
													<span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"> </a></span>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break-md"></div>


									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<div class="ax-row">
														<div class="ax-flex-block">
															<span class="ax-pos-left" style="width: 2.4rem;"><i
																class="ax-iconfont ax-icon-shield-f"></i></span> 
																<input type="text" class="yzm_input" placeholder="请输入验证码" style="width: 285px" id="yzm" /> 
																<img class="code" id="codeImage" src="../getcode"
																onclick="this.src='../getcode?' + Math.random()" />
															<div class="yzm_error" style="color: red; display: none">验证码格式错误...</div>
														</div>
													</div>
												</div>

											</div>
										</div>
									</div>


									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<div class="ax-row">
														<div class="ax-flex-block">
															<label class="ax-checkbox"><input
																name="free-agree" value="0" checked="" type="checkbox"><span>记住密码</span></label>
														</div>
														<a href="javascript:void(0)" class="ax-form-txt ax-color-ignore">忘记了密码？</a>
													</div>
												</div>
											</div>
										</div>
									</div>


									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-flex-block">
												<div class="ax-form-input">
													<button type="button" class="ax-btn ax-primary ax-full"
														onclick="login()">登录</button>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break"></div>
									<div class="ax-break ax-hide-tel"></div>
									<div class="ax-break ax-hide-tel"></div>

								</form>
							</li>
							<li>

									<div class="ax-break"></div>
									<div class="ax-break ax-hide-tel"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-me-f"></i></span>
														<input name="username" placeholder="输入名称" type="text" id="regU">
														<div class="regU_error" style="color: red; display: none">账号不能为空...</div>
														<span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"></a></span>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-lock-f"></i></span>
														 <input name="password" placeholder="输入密码" type="password" id="regP">
														 <div class="regP1_error" style="color: red; display: none">密码不能为空...</div>
														 <div class="regP2_error" style="color: red; display: none">密码长度必须在6-18位...</div>
														 <div class="regP3_error" style="color: red; display: none">密码必须包含字母和数字...</div>
														 <span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"></a></span>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break-md"></div>
									
									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-phone-f"></i></span> 
														<input name="password" placeholder="请输入手机号" type="text" id="regT">
														<div class="regT_error" style="color: red; display: none">请输入正确的手机号...</div>
														<span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"></a></span>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-email-f"></i></span> 
														<input name="email" placeholder="请输入邮箱" type="text" style="width:280px" id="regE">
												 		<button style="height:38px"  id="getCode" onclick="getYZM()" style="width:74px">获取验证码</button>
														<div class="regE_error" style="color: red; display: none">请输入正确的邮箱...</div>
														
												</div>
											</div>
										</div>
									</div>
									
									<div class="ax-form-group"  style="margin-top:12px">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<span class="ax-pos-left" style="width: 2.4rem;"><i
														class="ax-iconfont ax-icon-shield-f"></i></span> 
														<input name="yzm" placeholder="验证码" type="text" id="regYZM">
														<div class="regY_error" style="color: red; display: none">验证码格式错误...</div>
														<span class="ax-pos-right"><a href="javascript:void(0)"
														class="ax-iconfont ax-icon-close ax-val-none"></a></span>
												</div>
											</div>
										</div>
									</div>


									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-form-con">
												<div class="ax-form-input">
													<div class="ax-row">
														<div class="ax-flex-block">
															<label class="ax-checkbox"><input
																name="free-agree" value="0" checked="" type="checkbox" class="regToIndex"><span>注册成功后立即登录</span></label>
														</div>
													</div>
												</div>
											</div>
										</div>
									</div>


									<div class="ax-break-md"></div>

									<div class="ax-form-group">
										<div class="ax-flex-row">
											<div class="ax-flex-block">
												<div class="ax-form-input">
													<button type="button" class="ax-btn ax-primary ax-full" onclick="register()">注册</button>
												</div>
											</div>
										</div>
									</div>

									<div class="ax-break"></div>
									<div class="ax-break ax-hide-tel"></div>
									<div class="ax-break ax-hide-tel"></div>

							</li>
						</ul>
					</div>





				</div>
			</div>
		</div>
	</div>

	<!--正文结束-->

	<div class="footer">
		&#xa9; 2022 <a href="javascript:void(0)">霸天出品 必属精品</a>
	</div>

	
	<script type="text/javascript" src="js/jquery-3.6.0.js"></script>
	<script type="text/javascript" src="js/vue.js"></script>
	<script type="text/javascript" src="js/show-dialog.js"></script>
	<script src="js/ax.min.js" type="text/javascript"></script>
	<script>
	   //用户名  非空失焦
	   $("#mname").blur(function(){
		   let nickName = $("#mname").val();
		   if(nickName == "" || nickName == null){
			   $(".user_error").css("display","block");
		   }else{
			   $(".user_error").css("display","none");
		   }
	   })
	   
	   // 密码长度
	   $("#pwd").blur(function(){
		   let pwd = $("#pwd").val();
		   if(pwd.length < 6){
			   $(".pwd_error").css("display","block");
		   }else{
			   $(".pwd_error").css("display","none");
		   }
	   })
	   
	   //验证码格式  失焦
	   $("#yzm").blur(function(){
		   let yzm = $("#yzm").val();
		   if(yzm == "" || yzm == null || yzm.length < 4 || yzm.length > 4){
			   $(".yzm_error").css("display","block");
		   }else{
			   $(".yzm_error").css("display","none");
		   }
	   })
	
       function login(){
		   
		   let nickName = $("#mname").val();
		   let pwd = $("#pwd").val();
		   let yzm = $("#yzm").val();
		   
    	   $.post("../member/login",{nickName:nickName,pwd:pwd,yzm:yzm},data=>{
    		   if(data.code == 200){
					//登陆成功
					let ref = document.referrer;  //获取页面来源  从哪个界面登录
					if(ref == "" || ref.indexOf("register.html") > 0){  //从登陆界面或者注册来的
						sessionStorage.setItem("nickName",nickName)
						sessionStorage.setItem("mno",data.data.mno)
						location.href="index.html";							
					}else{
						sessionStorage.setItem("nickName",nickName)
						sessionStorage.setItem("mno",data.data.mno)
						location.href=ref;		
					}
					return;
				}
				
				if(data.code == 510){
					showmsg("验证码错误...","red");
					$("#codeImage").attr("src","../getcode?" + Math.random());
					return;
				}
				
				showmsg("账号或密码错误,请重新输入...","red");
				$("#codeImage").attr("src","../getcode?" + Math.random());
				return;
    	   },"json");
       }
	   
	   //注册
	   
	   //用户名非空
	   $("#regU").blur(function(){
		   let nickName = $("#regU").val();
		   if(nickName == "" || nickName == null){
			   $(".regU_error").css("display","block");
		   }else{
			   $(".regU_error").css("display","none");
		   }
	   })
	   
	   //密码判度  regP
	     $("#regP").blur(function(){
		   let pwd = $("#regP").val();
		   let reg = new RegExp(/^(?![^a-zA-Z]+$)(?!\D+$)/);
		  
		   
		   if(pwd == "" || pwd == null){
			   $(".regP1_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP1_error").css("display","none");
		   }
		   
		   
		   if(pwd.length<6 || pwd.length > 20){
			   $(".regP2_error").css("display","block");
			   $(".regP1_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP2_error").css("display","none");
		   }
		   
		   
		   if(!reg.test(pwd)){
			   $(".regP3_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP1_error").css("display","none");
			   return;
		   }else{
			   $(".regP3_error").css("display","none");
		   }
	   })
	   
	   // 手机号格式判断
	   $("#regT").blur(function(){
		   let myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
		   let tel = $("#regT").val();
		   if(!myreg.test(tel)){
			   $(".regT_error").css("display","block");
		   }else{
			   $(".regT_error").css("display","none");
		   }
	   })
	   
	   // 邮箱格式验证
	   // 手机号格式判断
	   $("#regE").blur(function(){
		   let myreg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;//验证邮箱的正则表达式
		   let email = $("#regE").val();
		   if(!myreg.test(email)){
			   $(".regE_error").css("display","block");
		   }else{
			   $(".regE_error").css("display","none");
		   }
	   })
	   
	   //注册
	   function getYZM(){
		   let nickName = $("#regU").val();
		   let pwd = $("#regP").val();
		   let tel = $("#regT").val();
		   let email = $("#regE").val();
		   let reg = new RegExp(/^(?![^a-zA-Z]+$)(?!\D+$)/);
		   let myreg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;//验证邮箱的正则表达式
		   
		   if(nickName == "" || nickName == null){
			   $(".regU_error").css("display","block");
			   return;
		   }else{
			   $(".regU_error").css("display","none");
		   }
		   
		   if(pwd == "" || pwd == null){
			   $(".regP1_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP1_error").css("display","none");
		   }
		   
		   if(pwd.length<6 || pwd.length > 20){
			   $(".regP2_error").css("display","block");
			   $(".regP1_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP2_error").css("display","none");
		   }
		   
		   if(!reg.test(pwd)){
			   $(".regP3_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP1_error").css("display","none");
			   return;
		   }else{
			   $(".regP3_error").css("display","none");
		   }
		   
		   let mytel=/^[1][3,4,5,7,8][0-9]{9}$/;
		   if(!mytel.test(tel)){
			   $(".regT_error").css("display","block");
			   return;
		   }else{
			   $(".regT_error").css("display","none");
		   }
		  
		   if(!myreg.test(email)){
			   $(".regE_error").css("display","block");
			   return;
		   }else{
			   $(".regE_error").css("display","none");
		   }
		   
		   if($(".regE_error").css("display") == "block" || $(".regU_error").css("display") == "block" || $(".regP1_error").css("display") == "block" || $(".regP2_error").css("display") == "block"
			   || $(".regP3_error").css("display") == "block" || $(".regT_error").css("display") == "block"){
			   return;
		   }
		   
		   let wait = 60;
		   let start = setInterval(function(){
			   wait--;
			   if(wait == 0){
				   $("#getCode").html("获取验证码");
				   $("#getCode").attr("disabled",false);
				   $("#regE").attr("disabled",false);
				   clearInterval(start)
				   return;
			   }else{
				   $("#getCode").css("width","74px");
				   $("#getCode").html(wait);
				   $("#getCode").attr("disabled",true);
				   $("#regE").attr("disabled",true);
			   }
		   },1000);
		   
		   $.post("../member/getCode",{email:email,nickName:nickName},rt=>{},"json");
	   }
	   
	   //注册
	   function register(){
		  
		   let yzm = $("#regYZM").val();
		   let nickName = $("#regU").val();
		   let pwd = $("#regP").val();
		   let tel = $("#regT").val();
		   let email = $("#regE").val();
		   let reg = new RegExp(/^(?![^a-zA-Z]+$)(?!\D+$)/);
		   let myreg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;//验证邮箱的正则表达式
		   
		   if(nickName == "" || nickName == null){
			   $(".regU_error").css("display","block");
			   return;
		   }else{
			   $(".regU_error").css("display","none");
		   }
		   
		   if(pwd == "" || pwd == null){
			   $(".regP1_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP1_error").css("display","none");
		   }
		   
		   if(pwd.length<6 || pwd.length > 20){
			   $(".regP2_error").css("display","block");
			   $(".regP1_error").css("display","none");
			   $(".regP3_error").css("display","none");
			   return;
		   }else{
			   $(".regP2_error").css("display","none");
		   }
		   
		   if(!reg.test(pwd)){
			   $(".regP3_error").css("display","block");
			   $(".regP2_error").css("display","none");
			   $(".regP1_error").css("display","none");
			   return;
		   }else{
			   $(".regP3_error").css("display","none");
		   }
		   
		   let mytel=/^[1][3,4,5,7,8][0-9]{9}$/;
		   if(!mytel.test(tel)){
			   $(".regT_error").css("display","block");
			   return;
		   }else{
			   $(".regT_error").css("display","none");
		   }
		  
		   if(!myreg.test(email)){
			   $(".regE_error").css("display","block");
			   return;
		   }else{
			   $(".regE_error").css("display","none");
		   }
		   
		   if($(".regE_error").css("display") == "block" || $(".regU_error").css("display") == "block" || $(".regP1_error").css("display") == "block" || $(".regP2_error").css("display") == "block"
			   || $(".regP3_error").css("display") == "block" || $(".regT_error").css("display") == "block" || $(".regY_error").css("display") == "block"){
			   return;
		   }
		   
		   let isChecked = false;
		   if($(".regToIndex").is(":checked") == true){
			   isChecked = true;
		   }
		   $.post("/member/register",{nickName,pwd,tel,email,yzm,isChecked},rt=>{
			    if(rt.code == 200 && isChecked){
			    	 showmsg("注册成功，正在跳往首页...","green",function(){
			    		 location.href="index.html";
			    	 });
			    }else if(rt.code == 200 && !isChecked){
			    	showmsg("注册成功，正在跳往登陆界面...","green",function(){
			    		 location.href="login.html";
			    	 });
			    }else if(rt.code == 510){
			    	showmsg("注册失败,验证码错误...","red");
			    }else if(rt.code == 523){
			    	showmsg("注册失败,该用户名已存在...","red");
			    }else if(rt.code == 520){
			    	showmsg("注册失败,该手机号已被注册...","red");
			    }else if(rt.code == 521){
			    	showmsg("注册失败,该邮箱已被注册...","red");
			    }else{
			    	showmsg("注册失败,请稍后再试...","red");
			    }
		   },"json");
		   
	   }
	   
    </script>
   
</body>

</html>